import { useDict } from '@/utils/dict/useDict'
let service_type = useDict('service_type')
let target_group_type = useDict('service_type')
export const searchList = [
  {
    type: 'input',
    name: '标题',
    field: 'title',
  },
  {
    type: 'select',
    name: '服务类型',
    field: 'serviceTypeId',
    selectList: service_type
  },
  {
    type: 'select',
    name: '服务对象',
    field: 'targetGroupId',
    selectList: target_group_type
  }
]

export const listColumns = [
  {
    title: '标题',
    key: 'title',
  },
  {
    title: '服务类型',
    key: 'serviceTypeName',
  },
  {
    title: '服务对象',
    key: 'targetGroupName',
  },
  {
    title: '服务地点',
    key: 'location',
  },
  {
    title: '成果形式',
    key: 'resultTypeName',
  },
  {
    title: '受益人数',
    key: 'beneficiaryCount',
  },
  {
    title: '服务周期',
    key: 'startDate',
    render: (item, row) => {
      return row.startDate + '至' + row.endDate
    }
  }
]


export const actionArr = [
  {
    action: 'look',
    value: '查看',
  },
  {
    action: 'edit',
    value: '编辑',
  },
  {
    action: 'del',
    value: '删除',
  }
]
export const btnList = [
  {
    action: 'add',
    value: '新增',
    auth: ''
  }
];

export const rules = {
  title: [
    { required: true, message: '请输入服务标题', trigger: 'blur' }
  ],
  serviceTypeId: [
    { required: true, message: '请选择服务类型', trigger: 'change' }
  ],
  targetGroupId: [
    { required: true, message: '请选择服务对象', trigger: 'change' }
  ],
  director: [
    { required: true, message: '请输入负责人', trigger: 'blur' }
  ],
  startDate: [
    { required: true, message: '请选择服务周期', trigger: ['blur','change'] }
  ],
  members: [
    { required: true, message: '成员', trigger: 'blur' }
  ],
  resultTypeId: [
    { required: true, message: '请选择成果形式', trigger: 'change' }
  ],
  location: [
    { required: true, message: '请输入服务地点', trigger: 'blur' }
  ],
  beneficiaryCount: [
    { required: true, message: '请输入受益人数', trigger: 'blur' },
  ],
  duration: [
    { required: true, message: '请输入服务时长', trigger: 'blur' },
  ],
  attachmentFileId: [
    { required: true, message: '请上传成果附件', trigger: 'blur' }
  ],
  technicalSummary: [
    { required: true, message: '技术方案摘要不能超过200字', trigger: 'blur' }
  ]
}